# Required variables:
# - SOURCE_FILES/HEADER_FILES/RESOURCE_FILES
# - EFFECT_FILES/POST_PROCESSORS/UI_FILES
#
MACRO(SETUP_TOOL EXE_NAME)
	if(KLAYGE_PLATFORM_WINDOWS_DESKTOP)
		set(RESOURCE_FILES $<TARGET_OBJECTS:KlayGE_RC>)
	else()
		set(RESOURCE_FILES "")
	endif()

	SOURCE_GROUP("Source Files" FILES ${SOURCE_FILES})
	SOURCE_GROUP("Header Files" FILES ${HEADER_FILES})
	SOURCE_GROUP("Resource Files" FILES ${RESOURCE_FILES})
	SOURCE_GROUP("Effect Files" FILES ${EFFECT_FILES})
	SOURCE_GROUP("Post Processors" FILES ${POST_PROCESSORS})
	SOURCE_GROUP("UI Files" FILES ${UI_FILES})

	ADD_EXECUTABLE(${EXE_NAME} ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES} ${EFFECT_FILES} ${POST_PROCESSORS} ${UI_FILES})

	target_include_directories(${EXE_NAME}
		PRIVATE
			${KLAYGE_PROJECT_DIR}/Tools/Include
	)

	SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES
		DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}
		CXX_VISIBILITY_PRESET hidden
		VISIBILITY_INLINES_HIDDEN ON
		OUTPUT_NAME ${EXE_NAME}
		FOLDER "KlayGE/Tools"
	)

	ADD_DEPENDENCIES(${EXE_NAME} ToolCommon)

	target_link_libraries(${EXE_NAME}
		PRIVATE
			ToolCommon
			KlayGE_DevHelper
			${KLAYGE_CORELIB_NAME}
			cxxopts
	)

	CREATE_PROJECT_USERFILE(KlayGE ${EXE_NAME})
ENDMACRO(SETUP_TOOL)

ADD_SUBDIRECTORY(ColorGradingTexGen)
ADD_SUBDIRECTORY(Common)
ADD_SUBDIRECTORY(Cooker)
ADD_SUBDIRECTORY(D3DCompilerWrapper)
ADD_SUBDIRECTORY(DistanceMapCreator)
ADD_SUBDIRECTORY(FFTLensEffectsGen)
ADD_SUBDIRECTORY(Fxml2Shader)
ADD_SUBDIRECTORY(FxmlJit)
ADD_SUBDIRECTORY(GLCompatibility)
ADD_SUBDIRECTORY(GLESCompatibility)
ADD_SUBDIRECTORY(HDRCompressor)
ADD_SUBDIRECTORY(HWCollect)
ADD_SUBDIRECTORY(ImposterGen)
ADD_SUBDIRECTORY(JudaTexPacker)
ADD_SUBDIRECTORY(KFontGen)
ADD_SUBDIRECTORY(NoiseTexGen)
ADD_SUBDIRECTORY(Normal2NaLength)
ADD_SUBDIRECTORY(PrefilterCube)
ADD_SUBDIRECTORY(Tex2JTML)
ADD_SUBDIRECTORY(VectorTexGen)
IF(KLAYGE_COMPILER_MSVC AND (CMAKE_GENERATOR MATCHES "^Visual Studio") AND KLAYGE_PLATFORM_WINDOWS_DESKTOP AND (KLAYGE_ARCH_NAME MATCHES "x64"))
	ADD_SUBDIRECTORY(KGEditor)
	ADD_SUBDIRECTORY(MtlEditor)
	ADD_SUBDIRECTORY(TexViewer)
ENDIF()
